
#include "UserLink.h"

void userLinkInit(UserLink * ul){
    ul->front = NULL;
    ul->rear = NULL;
    ul->size = 0; 
}


//添加用户其实也可以直接创建用户。
char* addUser(UserLink * ul,char * username){   //注意username生命周期
    char * prev_path = (char *)calloc(1024,sizeof(char));
    char root[] = "../netdisk";
    strcat(prev_path,root);
    strcat(prev_path,"/");
    strcat(prev_path,username);
    Node * newuser = (Node *)calloc(1,sizeof(Node));
    newuser->prev_path = prev_path;
    if(ul->size == 0){
        ul->front = newuser;
        ul->rear = newuser;
    }else{
        ul->rear->next = newuser;
        ul->rear = newuser;
    }
    ++ul->size;
    return prev_path;
}

bool findUser(UserLink * ul,char * username){
    
}
